#include <complex>
#include <fftw3.h>
#include <iostream>
using namespace std;


int main(int argc, char* argv[])
{
  	int N = 10;
    double *in;
	fftw_complex* out;
    fftw_plan p1, p2;
    in = new double[N]; 
	out = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * (N/2+1));
//    out = new complex<double>[N/2+1];
//    p1 = fftw_plan_dft_r2c_1d(N, in, reinterpret_cast<fftw_complex*>(out), FFTW_ESTIMATE);
//    p2 = fftw_plan_dft_c2r_1d(N, reinterpret_cast<fftw_complex*>(out), in, FFTW_ESTIMATE);
    p1 = fftw_plan_dft_r2c_1d(N, in, out, FFTW_ESTIMATE);
    p2 = fftw_plan_dft_c2r_1d(N, out, in, FFTW_ESTIMATE);
	for(int i = 0; i < N ; i++)
	{
	  in[i] = (double)i;
	}
    fftw_execute(p1); /* repeat as needed */
    fftw_execute(p2); /* repeat as needed */
//	for(int i = 0; i < N; i++)
//	{
//	  cout << in[i]/N << endl;
//	}
    fftw_destroy_plan(p1);
    fftw_destroy_plan(p2);
//	sleep(1);
	delete in;
	fftw_free(out);
}

